-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(web): link to asset and refer to item icons #1272
Conversation
WalkthroughThe pull request involves modifications to several components within the web application, primarily focusing on modal adjustments. The Changes
Possibly related PRs
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
✅ Deploy Preview for reearth-cms ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (4)
web/src/components/molecules/Common/ResizableProTable/index.tsx (1)
Line range hint
139-155
: Styling improvements with considerations for responsivenessThe changes to the
StyledProTable
component improve the toolbar layout, which aligns with the PR objectives. Here are some observations and suggestions:
Setting
flex-direction: row
for.ant-pro-table-list-toolbar-container
ensures horizontal alignment of toolbar elements, which is good for desktop views.The updates to
.ant-pro-table-list-toolbar-left
remove the margin and set a max-width, which can improve the layout consistency.Changing
.ant-pro-table-list-toolbar-right
toflex: inherit
might affect its sizing behavior.These changes enhance the desktop layout, but consider the following:
- Ensure the layout remains usable on smaller screens. Consider adding media queries for responsive behavior.
- The fixed
max-width
for.ant-input-group-wrapper
might not scale well for all screen sizes. Consider using relative units or a responsive approach.Example of a more responsive approach:
.ant-pro-table-list-toolbar-left { flex: 1; max-width: calc(100% - 150px); margin: 0; .ant-pro-table-list-toolbar-search { width: 100%; } .ant-input-group-wrapper { min-width: 200px; max-width: 100%; /* Allow full width on smaller screens */ width: 100%; /* Ensure it takes full width of its container */ } } @media (min-width: 768px) { .ant-input-group-wrapper { max-width: 230px; /* Apply max-width on larger screens */ } }This approach allows for better adaptability across different screen sizes while maintaining the intended layout on larger screens.
web/src/components/molecules/Content/LinkItemModal/index.tsx (1)
112-117
: LGTM: Simplified link status logicThe simplification of the link status logic improves code readability and reduces complexity. This change aligns well with the removal of the hoveredAssetId state.
Consider extracting the link status check into a separate variable for improved readability:
- const isLink = item.id !== linkedItem; + const isUnlinked = item.id !== linkedItem; return ( <Button type="link" - icon={<Icon icon={isLink ? "linkSolid" : "unlinkSolid"} size={16} />} - onClick={() => handleClick(isLink, item)} + icon={<Icon icon={isUnlinked ? "linkSolid" : "unlinkSolid"} size={16} />} + onClick={() => handleClick(isUnlinked, item)} /> );This small change makes the intent clearer and aligns the variable name with its usage.
web/src/components/molecules/Content/LinkItemRequestModal/LinkItemRequestModal.tsx (1)
172-172
: Approved, but consider responsive design implications.The change from a minimum height of "50vh" to a fixed height of "70vh" for the modal body is acceptable and aligns with the PR objectives of making styling adjustments. This change will provide a consistent height across different screen sizes and potentially make better use of vertical space on most screens.
However, it's important to consider the implications for responsive design:
- On smaller screens or window sizes, a fixed height of 70vh might lead to content overflow or a suboptimal user experience.
- The loss of flexibility (changing from min-height to height) might affect how the modal adapts to different content lengths.
Consider the following suggestions to enhance responsiveness:
Use a media query to adjust the height for smaller screens:
@media (max-height: 600px) { height: 90vh; }Alternatively, retain some flexibility by using
min-height
instead ofheight
:min-height: "70vh", max-height: "90vh",These approaches would maintain the intended design while ensuring better adaptability across different devices and screen sizes.
web/src/components/molecules/Common/LinkAssetModal/LinkAssetModal.tsx (1)
240-240
: Consider flexible modal sizing for better responsivenessThe modal's body height has been changed from a minimum of "50vh" to a fixed "70vh". While this increases the visible content area, it may lead to responsiveness issues on smaller screens or devices with limited vertical space.
Consider using a more flexible approach, such as:
- Combining
min-height
withmax-height
to ensure the modal is neither too small nor too large.- Using media queries to adjust the height based on screen size.
- Implementing a resizable modal component that allows users to adjust the size as needed.
Example:
height: clamp(50vh, 70vh, calc(100vh - 100px));This would set a minimum height of 50vh, a preferred height of 70vh, and a maximum height of the viewport height minus 100px for padding.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (4)
- web/src/components/molecules/Common/LinkAssetModal/LinkAssetModal.tsx (4 hunks)
- web/src/components/molecules/Common/ResizableProTable/index.tsx (1 hunks)
- web/src/components/molecules/Content/LinkItemModal/index.tsx (4 hunks)
- web/src/components/molecules/Content/LinkItemRequestModal/LinkItemRequestModal.tsx (1 hunks)
🧰 Additional context used
🔇 Additional comments (6)
web/src/components/molecules/Content/LinkItemModal/index.tsx (2)
2-2
: LGTM: Simplified import statementThe removal of
useState
from the import statement aligns with the simplification of state management in this component. This change reduces unnecessary imports and improves code clarity.
156-156
: LGTM: Updated useMemo dependenciesThe removal of
hoveredAssetId
from the dependencies array of theuseMemo
hook is consistent with the overall changes in state management. This update ensures that the memoizedcolumns
are only recalculated when necessary, potentially improving performance.web/src/components/molecules/Common/LinkAssetModal/LinkAssetModal.tsx (4)
2-2
: Removal of useState hook: Simplification of state managementThe removal of the
useState
hook from the import statement suggests a simplification of the component's state management. This change aligns with the removal of hover state tracking mentioned in the summary.
129-129
: Simplified link status logic: Improved readability and performanceThe logic for determining the
isLink
status has been simplified to a direct comparison between the asset ID and the linked asset ID. This change eliminates the need for hover state management, potentially improving performance by reducing unnecessary state updates. The code is now more straightforward and easier to understand.
182-182
: Updated useMemo dependencies: Consistent with hover state removalThe removal of
hoveredAssetId
from theuseMemo
dependencies is consistent with the earlier changes that eliminated hover state management. This update ensures that the memoizedcolumns
array is only recomputed when necessary, potentially improving performance.
Line range hint
1-270
: Overall assessment: Improved component with simplified state managementThe changes to the
LinkAssetModal
component have generally improved its implementation by:
- Removing unnecessary hover state management, simplifying the code and potentially improving performance.
- Updating the modal size to show more content.
These changes align well with the PR objectives of fixing asset linking issues. The code is now more maintainable and efficient. However, consider revisiting the modal sizing approach to ensure optimal responsiveness across different devices and screen sizes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 6
🧹 Outside diff range and nitpick comments (4)
web/src/components/molecules/Content/Form/ReferenceFormItem/index.tsx (2)
Line range hint
92-98
: Approved: UI enhancement with custom styled buttonThe replacement of
Button
withUnreferButton
and the icon change improve the UI consistency and visual representation. The functionality remains intact.Consider adding a tooltip to the button to explain its function, especially since it's only an icon now:
<UnreferButton type="link" icon={<Icon icon={"arrowUpRightSlash"} size={16} />} onClick={() => { onChange?.(); }} + title={t("Unrefer item")} />
133-136
: Approved: New styled component for consistent UIThe addition of the
UnreferButton
styled component enhances UI consistency for unrefer actions throughout the application.Consider using a color variable instead of a hardcoded hex value for better maintainability:
const UnreferButton = styled(Button)` - color: #000000d9; + color: var(--color-text-primary); `;This assumes you have a color variable defined for primary text. If not, consider adding one to your global styles.
web/src/i18n/translations/ja.yml (2)
12-24
: Consider revising the translation for "Delete Personal Account"The current translation for "Delete Personal Account" (アカウントを削除) on line 22 is somewhat ambiguous. It translates to "Delete Account" without specifying that it's a personal account.
Consider changing the translation to "個人アカウントを削除" to more accurately reflect the English meaning and distinguish it from other types of account deletion.
47-53
: Consider translating file format stringsThe translations for various file formats (lines 47-53) are currently left as-is in English. While this is often acceptable for technical terms, you might want to consider adding Japanese explanations for better user understanding.
For example:
- "PNG/JPEG/TIFF/GIF" could be "PNG/JPEG/TIFF/GIF画像ファイル"
- "3D Tiles" could be "3Dタイル"
- "GLTF/GLB" could be "GLTF/GLB 3Dモデルファイル"
This approach maintains the technical accuracy while providing additional context for Japanese users.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
⛔ Files ignored due to path filters (1)
web/src/components/atoms/Icon/Icons/arrowUpRightSlash.svg
is excluded by!**/*.svg
📒 Files selected for processing (5)
- web/src/components/atoms/Icon/icons.ts (2 hunks)
- web/src/components/molecules/Content/Form/ReferenceFormItem/index.tsx (3 hunks)
- web/src/components/molecules/Content/LinkItemModal/index.tsx (4 hunks)
- web/src/i18n/translations/en.yml (1 hunks)
- web/src/i18n/translations/ja.yml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- web/src/components/molecules/Content/LinkItemModal/index.tsx
🧰 Additional context used
🪛 yamllint
web/src/i18n/translations/en.yml
[error] 1-1: wrong new line character: expected \n
(new-lines)
web/src/i18n/translations/ja.yml
[error] 1-1: wrong new line character: expected \n
(new-lines)
🔇 Additional comments (7)
web/src/components/molecules/Content/Form/ReferenceFormItem/index.tsx (1)
104-104
: Approved: Improved context-aware button textThe conditional text for the
StyledButton
enhances user experience by clearly indicating the action based on the current state (replace or refer). The use of thet
function ensures proper internationalization.web/src/components/atoms/Icon/icons.ts (3)
58-58
: LGTM: New icon import follows existing conventions.The import statement for the new
ArrowUpRightSlash
icon is consistent with the existing import pattern and naming conventions used in this file.
127-127
: LGTM: New icon correctly added to the export object.The new
arrowUpRightSlash
icon is properly added to the default export object, maintaining consistency with existing entries and preserving alphabetical order.
58-58
: Verify usage of the new icon in relation to PR objectives.The new
ArrowUpRightSlash
icon has been successfully added. To ensure it aligns with the PR objectives of "fix(web): link to asset and refer to item icons", please confirm that this icon is being utilized in the relevant components for linking assets or referring to item icons.Also applies to: 127-127
✅ Verification successful
Usage of the new
ArrowUpRightSlash
icon is correctly implemented and aligns with the PR objectives.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Search for usage of the new ArrowUpRightSlash icon in relevant components # Test: Look for imports or usage of ArrowUpRightSlash in web components rg --type typescript --type tsx 'ArrowUpRightSlash|arrowUpRightSlash' web/src/componentsLength of output: 125
Script:
#!/bin/bash # Description: Search for usage of the new ArrowUpRightSlash icon in relevant components # Test: Look for imports or usage of ArrowUpRightSlash in web components rg 'ArrowUpRightSlash|arrowUpRightSlash' web/src/components --glob '*.ts' --glob '*.tsx'Length of output: 562
web/src/i18n/translations/en.yml (1)
1-557
: LGTM: Comprehensive translation key structureThe translation file structure looks good and appears to cover a wide range of functionalities for the Re:Earth CMS application. The keys are descriptive and follow a consistent naming convention. The empty string values are appropriate for a template translation file, allowing for easy addition of actual translations later.
A few observations:
- The file includes translations for various UI elements, error messages, and system notifications.
- The keys are organized in a flat structure, which is suitable for most translation management systems.
- Some keys use interpolation (e.g., line 285:
Are you sure you want to delete this model: Are you sure you want to delete this model <strong>{{name}}</strong>?
), which is good for dynamic content.As development progresses, ensure that:
- All used translation keys in the application are present in this file.
- Actual translations are added for each key before deployment.
- Any unused keys are removed to keep the file maintainable.
🧰 Tools
🪛 yamllint
[error] 1-1: wrong new line character: expected \n
(new-lines)
web/src/i18n/translations/ja.yml (2)
1-557
: Overall, the translations appear comprehensive and well-structured.The file contains a wide range of translations covering various aspects of the application, including account management, project settings, asset uploads, and workspace management. The translations seem to be appropriate for a Japanese audience.
However, here are a few suggestions for improvement:
Consider reviewing the translation for "Oops!" (line 3). The current translation is an empty string, which might not be the intended behavior. You may want to use a culturally appropriate expression of surprise or apology.
The translation for "OK" (line 105) is also an empty string. Consider using "OK" or "はい" depending on the context.
The translation for "example" (line 393) is also an empty string. Consider translating it to "例" or "例えば".
The translation for "is used in" (line 509) is an empty string. Consider translating it to "で使用されています".
These suggestions aim to improve the completeness and consistency of the translations.
🧰 Tools
🪛 yamllint
[error] 1-1: wrong new line character: expected \n
(new-lines)
1-557
: Overall, the translations are well done and comprehensiveThe translations cover a wide range of functionality and seem to be appropriate for a Japanese audience. The language used is polite and professional, which is suitable for a business application.
Great job on providing such a comprehensive set of translations! The suggestions provided in the review comments are minor improvements that can enhance the overall quality and consistency of the translations.
🧰 Tools
🪛 yamllint
[error] 1-1: wrong new line character: expected \n
(new-lines)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
- web/src/components/atoms/Icon/icons.ts (2 hunks)
🔇 Additional comments (1)
web/src/components/atoms/Icon/icons.ts (1)
59-59
: LGTM!The import follows the established pattern and naming convention.
@@ -124,6 +125,7 @@ export default { | |||
asset: Asset, | |||
listBullets: ListBullets, | |||
arrowUpRight: ArrowUpRight, | |||
arrowUpRightSlash: ArrowUpRightSlash, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codebase verification
Migration to arrowUpRightSlash
icon is incomplete - found remaining unlinkSolid
usages
The verification revealed that while arrowUpRightSlash
is being used in some components, there are still two components using the old unlinkSolid
icon:
web/src/components/molecules/Common/Form/AssetItem/index.tsx
web/src/components/molecules/Common/LinkAssetModal/LinkAssetModal.tsx
These components should be updated to use the new arrowUpRightSlash
icon for consistency with the rest of the codebase.
🔗 Analysis chain
Verify the icon replacement across the codebase.
The icon mapping is correctly added. Since this icon is replacing unlinkSolid
in the ReferenceFormItem
component, let's verify there are no other components still using the old icon.
Let me try with a different command that doesn't rely on file type specifications.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for any remaining usage of unlinkSolid icon
# to ensure complete migration to arrowUpRightSlash
echo "Checking for remaining unlinkSolid icon usage..."
rg -l "unlinkSolid" --type ts --type tsx
echo "Checking for new arrowUpRightSlash icon usage..."
rg -l "arrowUpRightSlash" --type ts --type tsx
Length of output: 357
Script:
#!/bin/bash
# Search for unlinkSolid usage across all files
echo "Checking for remaining unlinkSolid icon usage..."
rg "unlinkSolid"
echo -e "\nChecking for new arrowUpRightSlash icon usage..."
rg "arrowUpRightSlash"
Length of output: 1074
Overview
This PR fixes the link to asset and refer to item icons.
Memo
Small styling fixes are included.
Summary by CodeRabbit
New Features
Bug Fixes
Documentation